package com.pactera.openresource.adapter;

//import org.springframework.messaging.Message;
import org.springframework.integration.Message;
import org.springframework.integration.annotation.Transformer;
import org.springframework.integration.support.MessageBuilder;

//import xpadro.spring.integration.ws.types.GetCourseRequest;

//@Component
public class MyMsgTransformer {
//	private Logger logger = LoggerFactory.getLogger(this.getClass());

//	@Transformer(inputChannel="fileProcessingChannel", outputChannel="nullChannel")
	// todo to be deleted?
	// steve test the filter
	public Message<String> buildRequest(Message<String> msg) {
//		logger.info("Building request for course [{}]", msg.getPayload());
//		GetCourseRequest request = new GetCourseRequest();
//		request.setCourseId(msg.getPayload());
		
		System.out.println("CourseRequestBuilder: " + msg.getPayload());
		
		return msg;
	}


	@Transformer
	public Message<?> transform(Message<?> msg) {
		System.out.println("MyMsgTransformer: " + msg.getPayload());
		
		return MessageBuilder
				.withPayload(msg.getPayload())
				.copyHeaders(msg.getHeaders()).build();
	}

}
